import { request } from '@/utils/request';

enum API {
  URL = '/metro/line/station',
}

/**
 * 获取line的所有stations
 * @param id
 */
export function getMetroLineStations(id: string) {
  return request.get<{ line: BaseFormData; stations: BaseFormData[] }>(API.URL + '/', {
    params: { line: id },
  });
}

export function getMetroLineStation(id: string) {
  return request.get<BaseFormData>(API.URL, { params: { id } });
}

/**
 * 删除
 * @param id - 删除id值
 */
export function deleteMetroLineStation(id: string) {
  return request.delete(API.URL, { params: { id } });
}

/**
 * 新增数据
 * @param data - 请求数据
 * @param line
 */
export function createMetroLineStation(data: BaseFormData, line: string) {
  return request.post(API.URL, data, { params: { line } });
}

/**
 * 修改数据
 * @param id - 修改id值
 * @param data - 请求数据
 */
export function updateMetroLineStation(id: string, data: BaseFormData) {
  return request.put(API.URL, data, { params: { id } });
}
